package com.example.blogserver.a_utils;

import lombok.Getter;
import org.springframework.stereotype.Component;

import java.util.Random;

@SuppressWarnings({"all"})
@Getter
@Component
public class BuildUserId {
    public String personId;//个人账号

    public void init(){
        StringBuilder stringBuilder = new StringBuilder();
        Random random = new Random();
        while (stringBuilder.length() < 10){//生成随机10位数账号
            int c = random.nextInt(10);
            if (stringBuilder.length() == 0){
                if (c != 0){
                    stringBuilder.append(c);
                }
            }else {
                stringBuilder.append(c);
            }
        }
        personId = stringBuilder.toString();
    }
}
